WRANGLERS

Bulging waistlines

a range plot showing BMI by gender

Photo by Towfiqu Barbhuiya on Unsplash

Photo by Towfiqu Barbhuiya on Unsplash

I’m in good shape. That shape is round…
— Jarod Kintz


Ingest

country, year, bmi

df_males <- read.csv("archetypes/bulging-waistlines/mean-body-mass-index-bmi-in-adult-males.csv", header = TRUE, stringsAsFactors = TRUE)
df_males
df_females <- read.csv("archetypes/bulging-waistlines/mean-body-mass-index-bmi-in-adult-women.csv", header = TRUE, stringsAsFactors = TRUE)
df_females

Wrangle

join the data sets, filter, clean field names

# full join by all common fields
df_wrangle <- full_join(df_males, df_females, by = c("Entity", "Code", "Year"))

# take latest year
df_wrangle <- filter(df_wrangle, Year == 2016)

# clean names with spaces
df_wrangle <- df_wrangle %>% janitor::clean_names()

df_wrangle

Plot

country bmi values for male and female

  • less than 18.5, it falls within the underweight range
  • 18.5 to <25, it falls within the healthy weight range
  • 25.0 to <30, it falls within the overweight range
  • 30.0 or higher, it falls within the obesity range
  • class 1 obesity: BMI of 30 to < 35
  • class 2 obesity: BMI of 35 to < 40
  • class 3 obesity: BMI of 40 or higher. Class 3 obesity is sometimes categorized as “severe” obesity.
# entity, code, year, mean_bmi_male, mean_bmi_female

theme_opts <- theme(
    panel.grid.major.x = element_blank(),
    panel.grid.major.y = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.minor.y = element_blank(),
    axis.ticks = element_line(),
    legend.position = "none"
  )

v1 = ggplot(df_wrangle) + 
  geom_segment(aes(x=mean_bmi_male, y=entity, xend=mean_bmi_female, yend=entity), 
               lineend = "round", linejoin = "round", size=2, color="#cccccc") + 
  geom_point(aes(x=mean_bmi_male, y=entity), shape=22, alpha=1.0, size=2, color="#555555", fill="#555555") +
  geom_point(aes(x=mean_bmi_female, y=entity), shape=22, alpha=1.0, size=2, color="#00E5FF", fill="#00E5FF") +
  geom_vline(xintercept = 18.5, color = "red", linetype = "dashed") +
  geom_vline(xintercept = 25, linetype = "dashed") +
  geom_vline(xintercept = 30, color = "orange", linetype = "dashed") +
  geom_vline(xintercept = 35, color = "red", linetype = "dashed") +
  geom_vline(xintercept = 40, color = "red", linetype = "dashed") +
  scale_x_continuous() +
  scale_y_discrete() +
  labs(title = "Mean BMI Values by Gender") +
  theme_minimal() +
  theme_opts +
  xlab(NULL) +
  ylab(NULL)

girafe(ggobj = v1, width_svg = 1440/72, height_svg = 1920/72,
       options = list(opts_sizing(rescale = TRUE, width = 0.9)))

References

citations for narrative and data sources

Inspiration: Economist
Data Source: Our World in Data